package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.common.NettyServiceDTO;
import com.itlong.cloud.POJO.DTO.property.CalculateCostsDTO;
import com.itlong.cloud.POJO.DTO.property.CarIssueDTO;
import com.itlong.cloud.POJO.DTO.property.PaymentParkingCostsDTO;
import com.itlong.cloud.project.property.IParkCarHttpServiceClient;
import com.itlong.cloud.property.service.IParkCarHttpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * <desc>
 *      暴露操作netty通道接口Feign代理接口
 * </desc>
 *
 * @createDate 2017/12/07
 */
@RestController
public class ParkCarHttpServiceClientResource implements IParkCarHttpServiceClient {
    @Autowired
    IParkCarHttpService iParkCarHttpService;

    /**
     * <desc>
     *      停车算费
     * </desc>
     *
     * @param dto
     * @return 金额
     * @author Jiaqi.X
     * @createDate 2018/11/11
     */
    @RequestMapping(path="/property/parkCarHttp/queryParkCarFee",method = {RequestMethod.POST})
    public NettyServiceDTO queryParkCarFee(@RequestBody CalculateCostsDTO dto) throws IOException{
        return iParkCarHttpService.queryParkCarFee(dto);
    }


    /**
     * <desc>
     *      缴费通知
     * </desc>
     *
     * @param dto
     * @return
     * @author Jiaqi.X
     * @createDate 2018/11/12
     */
    @Override
    @RequestMapping(path="/property/parkCarHttp/carIssue",method = {RequestMethod.POST})
    public NettyServiceDTO carIssue(@RequestBody CarIssueDTO dto) throws IOException{
        return iParkCarHttpService.carIssue(dto);
    }

    /**
     * <desc>
     *      缴费通知
     * </desc>
     *
     * @param dto
     * @return
     * @author Jiaqi.X
     * @createDate 2018/11/12
     */
    @Override
    @PostMapping(path="/property/parkCarHttp/paymentParkFee")
    public NettyServiceDTO paymentParkFee(@RequestBody PaymentParkingCostsDTO dto) throws IOException{
        return iParkCarHttpService.paymentParkingFee(dto);
    }
}
